#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 2e5 + 5;

ll h, w;
ll lowbit(ll x) { return x & -x; }
ll calc(ll& x, ll& y) {
  while (x != lowbit(x)) x -= lowbit(x);
  while (y * 5 < 4 * x) x >>= 1;
  if (y * 4 > 5 * x) y = x * 5 / 4;
  return x * y;
}
void solve() {
  cin >> h >> w;
  ll x1 = h, y1 = w;
  ll s1 = calc(x1, y1);
  ll x2 = h, y2 = w;
  ll s2 = calc(y2, x2);
  if (s1 > s2)
    cout << x1 << ' ' << y1;
  else
    cout << x2 << ' ' << y2 << endl;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int t = 1;
  while (t--) solve();
  return 0;
}